import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLEventListener;

/**
 * Created by WheelChen on 2017/5/18.
 *
 * 带型三角形
 */
public class TriangleStrip implements GLEventListener{
    @Override
    public void init(GLAutoDrawable glAutoDrawable) {


    }

    @Override
    public void dispose(GLAutoDrawable glAutoDrawable) {

    }

    @Override
    public void display(GLAutoDrawable glAutoDrawable) {
        System.out.println("绘制中");

        final GL2 gl2 = glAutoDrawable.getGL().getGL2();
        gl2.glBegin(GL2.GL_TRIANGLE_STRIP);
        gl2.glVertex3f(-0.5f, 0.5f, 0.0f);				// Top Left
        gl2.glVertex3f( 0.5f, 0.5f, 0.0f);				// Top Right
        gl2.glVertex3f( 0.5f,-0.5f, 0.0f);				// Bottom Right
        gl2.glVertex3f(-0.5f,-0.5f, 0.0f);				// Bottom Left
        gl2.glEnd();


    }

    @Override
    public void reshape(GLAutoDrawable glAutoDrawable, int i, int i1, int i2, int i3) {

    }
}
